from pylab import *
from PyQt4.Qt import *
import matplotlib.pyplot as plt
import numpy
import pickle


dx = 100.
dy = 100.
dt = 0.001
#f1 = open('D:/1/200808_143414_K1.txt', 'r')
#f2 = open('D:/1/200808_143414_K2.txt', 'r')
#f3 = open('D:/1/200808_143414_K3.txt', 'r')
#f4 = open('D:/1/200808_143414_K4.txt', 'r')

f1 = open('/home/gandhi/Dropbox/Magnetometer/Data/mpm001_4K/190808_150137_K1.txt', 'r')
f2 = open('/home/gandhi/Dropbox/Magnetometer/Data/mpm001_4K/190808_150137_K2.txt', 'r')
f3 = open('/home/gandhi/Dropbox/Magnetometer/Data/mpm001_4K/190808_150137_K3.txt', 'r')
f4 = open('/home/gandhi/Dropbox/Magnetometer/Data/mpm001_4K/190808_150137_K4.txt', 'r')

k1 = loadtxt(f1)
k2 = loadtxt(f2)
k3 = loadtxt(f3)
k4 = loadtxt(f4)

#print k1
#k1 = zeros(1000)
#k2 = ones(1000)
#k3 = zeros(1000)
#k4 = ones(1000)

k1 = k1-k1[:1]
k2 = k2-k2[:1]
k3 = k3-k3[:1]
k4 = k4-k4[:1]
ion()
hold(False)

K = ([k1], [k2], [k3], [k4])

#print resize(K, (2, 2))
B = resize(K, (4, 1000))
#kk = resize(obr[:, 1], (2, 2))
#print kk
#imshow(kk,   interpolation='bicubic')

#for i in range(0, 999):
   # obr = resize(B[:,i], (2, 2))
    #print obr
    #im = imshow(obr,  interpolation='bicubic', animated=True)
    #im.set_data(obr)
#t = arange(1, len(k3), 1)
#subplot(311)
#csd(t, k3, NFFT=1000,  Fs=1000,  window=mlab.window_hanning)
#subplot(312)
#psd(k3, 1000, 1000)
#plot(freq, k[1:])
#subplot(3, 1, 3)
#specgram(k3,  NFFT=1000,  Fs=1000,  window=mlab.window_hanning)

#obr = resize(B[:,100], (2, 2))
#im = imshow(obr,  interpolation='bicubic', animated=True)



f1.close()
f2.close()
f3.close()
f4.close()
